Skip to content

fix: repair failing tests and type errors across api and shared packages#43

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2447-1780881553
Open

fix: repair failing tests and type errors across api and shared packages#43
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2447-1780881553

Conversation

@stooit

@stooit stooit commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and TypeScript errors in the multi-package API repo. Final state: 22 tests pass, 0 fail; tsc --noEmit clean.

Changes

  • shared/types: Renamed User.userNameusername (canonical name the tests assert against).
  • shared/pagination: Implemented the paginate stub — 1-indexed pagination, start=(page-1)*size, returns data, page, pageSize, total, totalPages (Math.ceil(total/size), 0 on empty input; out-of-range pages return empty data).
  • api/routes/users: Added missing badRequest to the ../lib/errors import (was causing a runtime ReferenceError on the 400 path).
  • api/middleware/auth: Fixed case-sensitivity bug — public method list had "post" but Hono delivers uppercase method names, so POST /users was wrongly treated as protected.
  • tsconfig (root): Added "types": ["bun-types"] to resolve bun:test and process type errors. bun-types was already present in node_modules — no new dependencies added.
  • Removed three stale BUG:/TODO: comments that misdescribed the now-corrected code.

Verification

  • bun test → 22 pass / 0 fail
  • bunx tsc --noEmit → no errors

Assumptions

  • Canonical field name is username (lowercase), since test files are the source of truth and may not be modified.
  • bun-types in node_modules is acceptable to reference via tsconfig (no install performed, honouring the no-new-dependencies constraint).

Constraints honoured

No test files modified. No dependencies added. Only the changes required by the failing tests.

- shared: rename User.userName to canonical username field
- shared: implement paginate utility (1-indexed slice pagination)
- api: add missing badRequest import in users route
- api: fix auth middleware method-case bug (post -> POST)
- tsconfig: add bun-types to resolve bun:test/process type errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant